package 数学;

import java.util.*;

public class 快速筛取质数 {
	public static boolean[] f;
	public static int[] primes;
	public static int cnt = 0; // 记录质数的个数的
	
	public static void main(String[] args) {
		var sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		f = new boolean[n + 10];
		primes = new int[n + 10];
		is_prime(n);
		for(int i = 1; i <= cnt; i ++ ) {
			System.out.print(primes[i] + " ");
		}
	}
	
	public static void is_prime(int n) {
		for(int i = 2; i <= n; i ++ ) {
			if(!f[i]) { // 当前这个是质数
				primes[++ cnt] = i;
			}
			for(int j = 1; primes[j] <= n / i; j ++ ) {
				f[primes[j] * i] = true;
				if(primes[j] % i == 0 ) {
					break;
				}
			}
		}
	}
}
